"to strike sharply," 1719, probably of imitative origin. The noun is from 1737. The word in out of whack (1885) is perhaps the slang meaning "share, just portion" (1785), which may be from the notion of the blow that divides, or the rap of the auctioneer's hammer.
[1885+; probably fr whack, ''share, a just proportion,'' so called perhaps fr the blow that divides something or, like the auctioneer's hammer-rap, signals a fair share or deal]
have a crack at something, out of whack, wack
[probably echoic; in second verb sense, the use of whacks, ''any form of force,'' is attested among Chicago gunmen in 1932]